<?php
require_once 'Common/values.php';
require_once 'Common/theme.php';
require_once 'Common/database.php';
$_POST[search]='%'.$_POST[search].'%';
$result=mysql_query("SELECT * FROM tblkb WHERE lognumber LIKE '$_POST[search]' OR Name LIKE '$_POST[search]' OR Folder LIKE '$_POST[search]'");
echo '<center><h3>KB search results</h3>';
echo '<table width="1000px"><tr bgcolor="'.$colourtoprow.'"><td width="40px">Log number</td><td width="40px">DocNumber</td><td>Subject</td><td width="200px">Folder</td></tr>';
$i=0;
while($row = mysql_fetch_array($result))
  {
  echo '<tr id="row'.$i.'" onMouseOver="row'.$i.'.style.backgroundColor=\''.$colourselector.'\';" onmouseout="row'.$i.'.style.backgroundColor=\''.$colour.'\';" onclick="location.href=\'index.php?p=kb&l='.$row[lognumber].'\'"><td>'.$row[lognumber].'</td><td></td><td>'.$row[Name].'</td><td>'.$row[Folder].'</td></tr>';
$i++;
  }
$result=mysql_query("SELECT * FROM tblkbdocuments WHERE lognumber LIKE '$_POST[search]' OR DocNumber LIKE '$_POST[search]' OR Document LIKE '$_POST[search]' ");
  while($row = mysql_fetch_array($result))
  {
  echo '<tr id="row'.$i.'" onMouseOver="row'.$i.'.style.backgroundColor=\''.$colourselector.'\';" onmouseout="row'.$i.'.style.backgroundColor=\''.$colour.'\';" onclick="location.href=\'kb/documents/'.$row[Document].'\'"><td><b>'.$row[LogNumber].'</td><td>'.$row[DocNumber].'</td><td>'.$row[Document].'</td></tr>';
$i++;
  }
  echo '</table>';
?>
